package com.sdna.unified;

import java.io.UnsupportedEncodingException;

import com.sdna.rpc.RPCClientMgr;
import com.sdna.rpc.RPCClient;
import com.sdna.rpc.ParameterBuilder;



/**
 * Filename: ActivityManagere.java Description: Copyright: Copyright (c)
 * 2010-2020 Company: www.sdo.com
 * 
 * @author: huangcheng
 * @version: 1.0 Create at: 2010-3-16 2010 Modification Historty: Date Author
 *           Version Description
 *           ------------------------------------------------------ 2010-3-16 1.0
 *           create 1.0 version
 */

/**
  * This file is generated by GenerateServiceClient.py, SVN location:
  *     svn://192.168.90.69/i.sdo.com/sdk/trunk/unified/GenerateServiceClient.py
  *
  * Please DO NOT change this file!!! it is just a wrapper of unified service api.   
  */

public class FeedTemplateServiceClient {

	/**
	 * ע��ģ�壬����ģ�����
	 * 
	 * @param appId
	 * @param feedTitle
	 * @param feedContent
	 * @return templateId
	 * @throws Exception
	 */
	static public String addTemplate(long appId, String titleTemplate, String bodyTemplate) throws UnsupportedEncodingException{
		ParameterBuilder pb = new ParameterBuilder();
		pb.add("appId", appId);
		pb.add("titleTemplate", titleTemplate);
		pb.add("bodyTemplate", bodyTemplate);
		RPCClient client = RPCClientMgr.getClient();
		try {
			return client.doRequest("FeedTemplateService.addTemplate", pb.toString());
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			RPCClientMgr.restore(client);
		}
	}

	/**
	 * ���ģ��ID����ģ�����
	 * 
	 * @param templateId
	 * @return
	 * @throws Exception
	 */
	static public String getTemplateByTemplateId(long templateId) throws UnsupportedEncodingException{
		ParameterBuilder pb = new ParameterBuilder();
		pb.add("templateId", templateId);
		RPCClient client = RPCClientMgr.getClient();
		try {
			return client.doRequest("FeedTemplateService.getTemplateByTemplateId", pb.toString());
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			RPCClientMgr.restore(client);
		}
	}

	/**
	 * ���Ӧ��appIdȡ����ģ��
	 * 
	 * @param appId
	 * @return
	 * @throws Exception
	 */
	static public String getTemplate(long appId) throws UnsupportedEncodingException{
		ParameterBuilder pb = new ParameterBuilder();
		pb.add("appId", appId);
		RPCClient client = RPCClientMgr.getClient();
		try {
			return client.doRequest("FeedTemplateService.getTemplate", pb.toString());
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			RPCClientMgr.restore(client);
		}
	}

	/**
     * ���templateIdɾ��ģ��
     * @param templateId
     * @throws Exception
     */
	static public String deleteTemplateByTemplateId(long templateId) throws UnsupportedEncodingException{
		ParameterBuilder pb = new ParameterBuilder();
		pb.add("templateId", templateId);
		RPCClient client = RPCClientMgr.getClient();
		try {
			return client.doRequest("FeedTemplateService.deleteTemplateByTemplateId", pb.toString());
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			RPCClientMgr.restore(client);
		}
	}
}